package com.zhu.rpc.client;

import org.springframework.beans.factory.FactoryBean;

public class RpcFactoryBean <T> implements FactoryBean<T> {

    private Class cls;
    public RpcFactoryBean(){}

    @Override
    public T getObject() throws Exception {
        return (T) InterfaceProxy.newInstance(cls);
    }

    @Override
    public Class<?> getObjectType() {
        return cls;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public void setCls(Class cls) {
        this.cls = cls;
    }
}
